package cn.yinzhiping.rabbbitmqlearn.workconsume;

import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.concurrent.BlockingDeque;
import java.util.concurrent.LinkedBlockingDeque;

/**
 * 测试work模式中的第一个消费者,平均分配
 *
 * @author yinzhiping
 */
@Component
public class WorkConsumer1 {

    BlockingDeque<String> queue = new LinkedBlockingDeque<>();
    @Resource
    private ThreadPoolTaskExecutor taskExecutor;

    @RabbitListener(queuesToDeclare = @Queue("work"))
    public void getRecieve1(String message){
        System.out.println("getRecieve1:"+message);
    }



    @RabbitListener(queuesToDeclare = @Queue("work"))
    public void getRecieve2(String message){
        System.out.println("getRecieve2:"+message);
    }
}
